/**
 * Created by Yixin on 2017/8/7.
 */
angular
.module("makerspace.util",[])
    // 产生一个uuid
    // 来源 https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript 中的方法
    .service("uuidv4",function () {

        return function () {
            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
                var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
                return v.toString(16);
            });
        };
    });